//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public abstract class EffectProperties : IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            ReadXmlCore(context);
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            WriteXmlCore(context);
        }

        #endregion

        public static EffectProperties ReadEffectProperties(ReadContext c)
        {
            switch (c.ReaderLocalName)
            {
                case "effectLst":
                    EffectList l = new EffectList();
                    l.ReadXmlCore(c);
                    return l;
                case "effectDag":
                    EffectContainerProperties ec = new EffectContainerProperties();
                    ec.ReadXmlCore(c);
                    return ec;
                default:
                    return null;
            }
        }

        internal abstract void ReadXmlCore(ReadContext context);

        internal abstract void WriteXmlCore(WriteContext context);
    }

    public class EffectContainerProperties: EffectProperties
    {
        EffectContainer cont = new EffectContainer();
        internal override void ReadXmlCore(ReadContext context)
        {
            IOfficeXmlSerializableAs a = cont;
            a.ReadXmlAs("effectDag", context);
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            IOfficeXmlSerializableAs a = cont;
            a.WriteXmlAs("effectDag", context);
        }
    }
}